from ReadConfig import ReadConfig
from WriteEntity import WriteEntity
from WriteService import WriteService
from WriteDao import WriteDao
from WriteServiceImpl import WriteServiceImpl

def getConfigData():
    readConfig = ReadConfig('config.yml')
    configData = readConfig.readYaml()
    return configData['dir'],configData['pack'],configData['entity']

if __name__ == '__main__':

    rootDir,rootPack,entityList = getConfigData()

    for entity in entityList:
        writeEntity = WriteEntity(entity,rootPack,rootDir+'entity')
        writeEntity.writeEntity()

        writeDao = WriteDao(entity,rootPack,rootDir+'dao')
        writeDao.writeDao()

        writeService = WriteService(entity,rootPack,rootDir+'service')
        writeService.writeService()

        writeServiceImpl = WriteServiceImpl(entity,rootPack,rootDir+'service/impl')
        writeServiceImpl.writeServiceImpl()